export const extractError = error => {
    if (error && typeof error === 'object') {
        const { name = '', stack = '', message = '' } = error
        if (message) {
            return `name: ${name}\nmessage:${message}\nstack:${stack}`
        } else {
            return JSON.stringify(error)
        }
    } else if (typeof error === 'string') {
        return error
    } else {
        return ''
    }
}